package com.stox.charting.ui.swing.model.price;

import java.awt.Graphics;

import com.stox.charting.ui.swing.model.Chart;
import com.stox.charting.ui.swing.model.Theme;
import com.stox.charting.ui.swing.view.ChartView;
import com.stox.core.model.IBar;

public class PriceChart<T extends IBar> extends Chart<T> {
	private static final long serialVersionUID = -1116244742539974562L;

	private final PriceChartModel<T> priceChartModel;
	
	public PriceChart() {
		this.priceChartModel = new PriceChartModel<T>(this);
	}
	
	@Override
	public PriceChartModel<T> getModel() {
		return priceChartModel;
	}
	
	@Override
	public void setChartView(ChartView chartView) {
		if(chartView != null){
			chartView.setBackground(Theme.getColours().getChartBackground());
		}
		super.setChartView(chartView);
	}
	
	@Override
	public PriceChartView getChartView() {
		return (PriceChartView)super.getChartView();
	}
	
	@Override
	protected void paintComponent(Graphics g) {
		g.setColor(Theme.getColours().getBar());
		super.paintComponent(g);
	}
	
}
